Virtualization allows transforming a physical machine into multiple isolated logical machines. Virtual machines may be provisioned on hypervisors (e.g., KVM™, Xen™ VMWare™). Standard mechanisms involve placement algorithms that decide where to place the virtual machines in a computing infrastructure such as a cloud.
VMs may be co-located for various reasons, for example, to accommodate licensing costs for an operating system or the like (e.g., Windows™), for content aware inter VM sharing of memory pages, to reduce network bandwidth requirement, e.g., when response/transfer time between two or more tiers can be reduced drastically by co-locating VMs, to utilize private virtual local area network (VLAN) more akin to inter-process communication (IPC), to reduce power usage, and other reasons. When a new VM is provisioned that needs to be co-located with another VM on a hypervisor host or the like, a placement algorithm that is used to co-locate the VM on the computing infrastructure needs to be sharing-aware to be able to co-locate VMs based on particular conditions. For example, the computing system that is hosting the VM needs to be aware of, and passed explicitly with the various parameters for provisioning the VM. An indication or flag is usually provided to the placement algorithm and the placement algorithm needs to understand this request for co-location. Co-location can be performed in chains if requests are provisioned sequentially or in groups if simultaneously. An example of a co-location constraint may be: <resource_colocation name=“colocate” rsc=“resource1” with-rsc=“resource2” confidence=“MAXCONFIDENCE”/>. An example of anti-co-location constraint may be: <resource_colocation name=“anti-colocate” rsc=“resource1” with-rsc=“resource2” confidence=“-MAXCONFIDENCE”/>. Constraints may have confidence in between the − and + MAXCONFIDENCE, which are indications of the probability that the requested co-location can be performed either on same rack or container housing the racks or within a particular pod or data center. Anti-colocation is usually easier because a user can simply provision in another datacenter or in a completely different cloud environment without any changes to placement algorithm.